package top.rainf.mapper;

import org.apache.ibatis.annotations.Param;
import top.rainf.domain.vo.Post;
import org.apache.ibatis.annotations.Mapper;

import java.util.List;
import java.util.Map;

/**
 * @author 星环
 * @date 2023/5/10 11:37:28
 * @description
 */
 @Mapper
public interface PostMapper {


    List<Post> selectAll();
    Post selectById(int id);

    int deleteById(int id);

    int deleteByIds(List<Integer> idList);

    int updateById(Post post);

    List<Post> selectHottestPostLimit(@Param("num") int num);

    List<Post> selectAllByBlockIdPaged(@Param("id") int id,@Param("from") int from,@Param("numPerPage") int numPerPage);

    int selectTotalCount();

    int selectTotalCountInBlock(int blockId);

    List<Post> selectByPaged(Map paraMap);
    int selectCountPaged(Map paraMap);

    int insertNewPost(@Param("userId")int userId,
                      @Param("blockId") int blockId,
                      @Param("clazzId") int clazzId,
                      @Param("title") String title,
                      @Param("content") String content);

    List<Post> selectUserSimplePostListPaged(
            @Param("userId") int userId,
            @Param("start") int start,
            @Param("numPerPage") int numPerPage);

    int selectCountOfUserPost(int userId);

}
